package com.itealabs.postjson;

import java.io.Serializable;

/**
 * 
 * @version $Id: JsonReturn.java 5 2010-04-18 15:01:31Z iteahere $
 * @author itea
 * @date 2010-4-16
 */
public class JsonReturn implements Serializable {

	private static final long serialVersionUID = -6237791206510020679L;

	public enum State {/** SUCCEED! */OK, // OK, no exception or error occurred
		/** Thrown an exception. */EXCEPTION, // Oh no, waiters thrown an exception
		/** Something serious happened. */ERROR}; // Oops, something serious happened
	
	private Long idx;
	private State state;
	private Object result; // result processed by user when 'OK'.
	
	public JsonReturn(State state, Object result) {
		super();
		this.state = state;
		this.result = result;
	}
	
	public JsonReturn(Long idx, State state, Object result) {
		super();
		this.idx = idx;
		this.state = state;
		this.result = result;
	}

	public JsonReturn() {
		super();
	}

	public Long getIdx() {
		return idx;
	}

	public void setIdx(Long idx) {
		this.idx = idx;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}
	
}
